<template>
  <div class="full-calendar-header">
    <div class="header-left">
      <el-button size="small" type="primary" @click="settypesof(0)" circle>月</el-button>
      <el-button size="small" type="primary" @click="settypesof(1)" circle>周</el-button>
      <el-button size="small" type="primary" @click="settypesof(2)" circle>日</el-button>
    </div>
    <div class="header-center">
      <el-button
        type="primary"
        size="mini"
        icon="el-icon-arrow-left"
        class="prev-month"
        @click.stop="goPrev"
      ></el-button>
      <span class="title">{{title}}</span>
      <el-button
        type="primary"
        size="mini"
        icon="el-icon-arrow-right"
        class="next-month"
        @click.stop="goNext"
      ></el-button>
    </div>
    <div class="header-right">
      <el-button size="small" type="primary" circle>正</el-button>
      <el-button type="text">正常</el-button>
      <el-button size="small" type="danger" circle>冲</el-button>
      <el-button type="text">冲突</el-button>
    </div>
  </div>
</template>
<script >
import moment from "moment";

export default {
  props: {
    currentMonth: {},
    locale: {},
    settypesof: Function,
    typesof: Number,
    goPrev: Function,
    goNext: Function
  },
  computed: {
    title() {
      if (this.typesof == 0) {
        return this.currentMonth.locale(this.locale).format("YYYY-MM");
      } else if (this.typesof == 1) {
        return (
          moment(this.currentMonth)
            .startOf("week")
            .format("YYYY-MM-DD") +
          "------" +
          moment(this.currentMonth)
            .endOf("week")
            .format("YYYY-MM-DD")
        );
      } else if (this.typesof == 2) {
        return this.currentMonth.locale(this.locale).format("YYYY-MM-DD");
      }
      return "";
    }
  },
  methods: {
    // 左

  }
};
</script>
<style lang="scss">
.full-calendar-header {
  display: flex;
  align-items: center;
  .header-left,
  .header-right {
    flex: 1;
  }
  .header-center {
    flex: 3;
    text-align: center;
    .title {
      margin: 0 10px;
      font-size: 18px;
    }
    .prev-month,
    .next-month {
      cursor: pointer;
    }
  }
}
</style>
